import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export const constantRoutes = [
    {
        path: '/',
        redirect:'/home'
    },
    {
        path: '/login',
        component:()=>import('@/views/login')
    },{
        path: '/home',
        component:()=>import('@/views/home')
    },
    {
        path: '/forwardPost',
        component:()=>import('@/views/forward-post')
    },
    {
        path: '/hinge',
        component:()=>import('@/views/hinge')
    },
    {
        path: '/circle',
        component:()=>import('@/views/circle')
    },
    {
        path: '/bridge',
        component:()=>import('@/views/bridge')
    },
    {
        path: '/404',
        component: () => import('@/views/error-page/404'),
    },
    {
        path: '/401',
        component: () => import('@/views/error-page/401'),
    },
    { path: '*', redirect: '/404', hidden: true }
]

export const asyncRoutes = [

]

const createRouter = () => new Router({
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
    const newRouter = createRouter()
    router.matcher = newRouter.matcher // reset router
}

export default router
